#include "led.h"
#include "uart4.h"
#include "beep.h"
#include "command.h"
#include "key_IT.h"
#include "include/interrupt.h"
#include "timer-IT.h"
#include "si7006.h"

extern void printf(const char *fmt, ...);
void delay_ms(unsigned int ms)
{
	int i,j;
	for(i = 0; i < ms;i++)
		for (j = 0; j < 1800; j++);
}

extern char  buffer[LEN];
int main()
{
	unsigned short hum;
	short temp;
	si7006_init();

	while(1)
	{
		hum = si7006_read_hum_data(SI7006_SLAVE, MEASURE_HUM_CMD);
		temp = si7006_read_temp_data(SI7006_SLAVE, MEASURE_TEMP_CMD);

		hum = (hum * 125 / 65536 - 6)*10;//数字量转模拟量
		temp = (temp * 175.72 / 65535 - 46.85)*10;

		printf("measure hum = %d.%d\n", hum / 10, hum % 10);
		printf("measure temp = %d.%d\n", temp / 10, temp % 10);

		delay_ms(1000);

	}
	return 0;
}
